const saveToLocal = function(key, value) {
    if (typeof(value) == 'object') {
        value = JSON.stringify(value);
    }
    window.localStorage.setItem(key, value);
}

const loadFromLocal = function(key, type) {
    let value = window.localStorage.getItem(key);
    if (type == 'obj') {
        value = JSON.parse(value);
    }
    return value;
}
export {
    saveToLocal,
    loadFromLocal
}